<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>取消订单申请</title>
    <s:head/>
</head>
<script type="text/javascript">
    var id = "${id}";
    var type = "${type}";
    var businessId = "${businessId}";
    var formSetting = {
        title: "取消申请",
        module: "save",
        numCount: "1",
        columns: [{
            name: "cancelReason.id",
            label: "id",
            hidden: true
        }, {
            name: "cancelReason.content",
            label: "取消理由",
            type: "textarea"
        }],
        form: {
            'url': 'cancelReason-saveOrUpdate?id=' + id + "&type=" + type + "&businessId=" + businessId,
            'data': function () {
                if (id) {
                    var dataValue = "";
                    $.ajax({
                        url: "cancelReason-find?cancelReason.id=" + id,
                        async: false,
                        cache: false,
                        success: function (data) {
                            dataValue = data;
                        }
                    });
                    return dataValue;
                } else {
                    return null;
                }
            },
            'ajaxForm': {
                success: function () {
                    if (type == 1) {
// 						window.parent.location.href="declaration-listForSupToValidate?date="+new Date();
                    } else if (type == 2) {
                        window.parent.location.href = "trail-main?date=" + new Date();
                    } else if (type == 3) {
// 						window.parent.location.href="booking-listForSupToValidate?date="+new Date();
                    }
                }
            }
        },
        buttons: {
            custom: [
                {
                    id: "cancleBtn",
                    value: "取消",
                    click: function () {
                        jw.close();
                    }
                }
            ]
        }
    };
    $(document).ready(function () {
        $("#cancelForm").mrdForm(formSetting);
    });
</script>
<body>
<div style="width: 100%">
    <div id="cancelForm"></div>
</div>
</body>
</html>
